package com.tianpengtech.admin.dictionary;
import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.Model;
import com.tianpengtech.admin.AbstractAdminController;
import com.tianpengtech.admin.InitInterceptor;
import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.common.model.dictionary.Dictionary;

/**
* 路由配置地址：add("/admin/dictionary", DictionaryAdminController.class, "/admin/dictionary");
* 数据库映射地址：arp.addMapping(Dictionary.dao.tableName(),Dictionary.class);
*/
@Before(InitInterceptor.class)
public class DictionaryAdminController extends AbstractAdminController{

	@Override
	protected void config() {
		this.clazz=Dictionary.class;
		this.service=new DictionaryAdminServiceImpl();
	}

	@Override
	public void beforeAdd() {

		setAttr("parents",DictionaryDao.ME.readParents(0));
	}

	@Override
	public void beforeAdd(Model< ? > model) throws ValidateException {

	}

	@Override
	public void beforeQueryById(Model<?> model, int id) {
		setAttr("parents",DictionaryDao.ME.readParents(0));
	}

	@Override
	public void beforeUpdate(Model< ? > model) throws ValidateException {

	}

	@Override
	public void beforeDelete(Model< ? > model) {

	}

}

	